package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.UserDAOInterface;
import org.cuatrovientos.erp.model.User;
import org.springframework.beans.factory.annotation.Autowired;


public class UserBO implements UserBOInterface {
	
	// Get log4j logger
	private static final Logger logger = Logger.getLogger(UserBO.class);
	 
	@Autowired
    private UserDAOInterface userDAO;

	@Override
	public User selectById(int id) {
		logger.info("selectById: " + id);
		return userDAO.selectById(id);
	}

	@Override
	public List<User> selectAll() {
		logger.info("selectAll: ");
		return userDAO.selectAll();
	}

	@Override
	public List<User> search(String name) {
		logger.info("search : " + name);
		return userDAO.search(name);
	}

	@Override
	public void deleteById(int id) {
		logger.info("delete: " + id);
		 userDAO.deleteById(id);
	}

	@Override
	public void insert(User user) {
		logger.info("insert: " + user);
		userDAO.insert(user);
	}

	@Override
	public void update(User user) {
		logger.info("update: " + user);
		userDAO.update(user);
	}
}
